import java.util.HashSet;
import java.util.Objects;

/**
 * @author ganbo
 * @date 2022/10/19 11:51
 */
public class TT {

    public static void main(String[] args) {
        HashSet hashSet = new HashSet();
        User u1 = new User("luo");
        User u2 = new User("luo");
        System.out.println(u1.equals(u2));

        hashSet.add(u1);
        hashSet.add(u2);
        System.out.println(hashSet.size());

        System.out.println(u1.hashCode() + "   " + u2.hashCode());
    }
}

class User {
    private String name;

    public User(String name) {
        this.name = name;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        User user = (User) o;
        return Objects.equals(name, user.name);
    }

}


